#!/bin/sh

for OS in "linux" "darwin" "windows" "freebsd"; do
	GOOS=$OS  CGO_ENABLED=0 GOARCH=amd64 go build
	FOLDER=phishery1.0.2$OS-amd64
	ARCHIVE=$FOLDER.tar.gz
	mkdir $FOLDER
	cp LICENSE $FOLDER
	cp credentials.json $FOLDER
	cp settings.json $FOLDER
	cp server.crt $FOLDER
	cp server.key $FOLDER
	cp template.dotx $FOLDER
	if [ $OS = "windows" ] ; then
		cp phishery.exe $FOLDER
		rm phishery.exe
	else
		cp phishery $FOLDER
		rm phishery
	fi
    COPYFILE_DISABLE=1 tar -czf $ARCHIVE $FOLDER
	rm -rf $FOLDER
	echo $ARCHIVE
done